package producer_customer;

import java.util.Random;

public class Producer extends Thread{
	private Repository<BaoZi> zhenglong;
	public Producer(Repository<BaoZi> zhenglong){
		this.zhenglong=zhenglong;
	}
@Override
public void run() {
	String[] names={"菜包","肉包","豆沙包","无所谓"};
	int c=0;
	Random rd=new Random();
	while(true){
		BaoZi bz=new BaoZi(names[rd.nextInt(4)]);
		zhenglong.save(bz);
		try {
			Thread.sleep(500);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
		
}
}
